<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>colorizer Docs</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>colorizer</h1>


<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>


<h2>Modules</h2>
<ul class="nowrap">
  <li><strong>colorizer</strong></li>
  <li><a href="../modules/colorizer.buffer.html">buffer</a></li>
  <li><a href="../modules/colorizer.color.html">color</a></li>
  <li><a href="../modules/colorizer.config.html">config</a></li>
  <li><a href="../modules/colorizer.constants.html">constants</a></li>
  <li><a href="../modules/colorizer.matcher.html">matcher</a></li>
  <li><a href="../modules/colorizer.parser.rgb_hex.html">parser.rgb_hex</a></li>
  <li><a href="../modules/colorizer.parser.hsl.html">parser.hsl</a></li>
  <li><a href="../modules/colorizer.parser.names.html">parser.names</a></li>
  <li><a href="../modules/colorizer.parser.oklch.html">parser.oklch</a></li>
  <li><a href="../modules/colorizer.parser.rgb.html">parser.rgb</a></li>
  <li><a href="../modules/colorizer.parser.rgba_hex.html">parser.rgba_hex</a></li>
  <li><a href="../modules/colorizer.parser.xterm.html">parser.xterm</a></li>
  <li><a href="../modules/colorizer.sass.html">sass</a></li>
  <li><a href="../modules/colorizer.tailwind.html">tailwind</a></li>
  <li><a href="../modules/trie.html">trie</a></li>
  <li><a href="../modules/colorizer.usercmds.html">usercmds</a></li>
  <li><a href="../modules/colorizer.utils.html">utils</a></li>
</ul>

</div>

<div id="content">

<h1>Module <code>colorizer</code></h1>
<p>Requires Neovim >= 0.7.0 and `set termguicolors`</p>
<p>Highlights terminal CSI ANSI color codes.</p>
    <h3>See also:</h3>
    <ul>
         <li><a href="../modules/colorizer.html#setup">colorizer.setup</a></li>
         <li><a href="../modules/colorizer.html#attach_to_buffer">colorizer.attach_to_buffer</a></li>
         <li><a href="../modules/colorizer.html#detach_from_buffer">colorizer.detach_from_buffer</a></li>
    </ul>
    <h3>Usage:</h3>
    <ul>
        <pre class="example"> Establish the autocmd to highlight all filetypes.

      `lua require(&quot;colorizer&quot;).setup()`

Highlight using all css highlight modes in every filetype

      `lua require(&quot;colorizer&quot;).setup(user_default_options = { css = true })`

==============================================================================
USE WITH COMMANDS                                          *colorizer-commands*

  *:ColorizerAttachToBuffer*

      Attach to the current buffer and start continuously highlighting
      matched color names and codes.

      If the buffer was already attached(i.e. being highlighted), the
      settings will be reloaded. This is useful for reloading settings for
      just one buffer.

  *:ColorizerDetachFromBuffer*

      Stop highlighting the current buffer (detach).

  *:ColorizerReloadAllBuffers*

      Reload all buffers that are being highlighted currently.
      Calls ColorizerAttachToBuffer on every buffer.

  *:ColorizerToggle*
      Toggle highlighting of the current buffer.

USE WITH LUA

ATTACH
  Accepts buffer number (0 or nil for current) and an option
  table of user_default_options from `setup`.  Option table can be nil
  which defaults to setup options.

      Attach to current buffer with local options:
          require(&quot;colorizer&quot;).attach_to_buffer(0, {
            mode = &quot;background&quot;,
            css = false,
          })

      Attach to current buffer with setup options:
          require(&quot;colorizer&quot;).attach_to_buffer()

          Accepts an optional buffer number (0 or nil for current).  Defaults to
          current buffer.

DETACH

      Detach to buffer with id 22:
          require(&quot;colorizer&quot;).attach_to_buffer(22)

      Detach from current buffer:
          require(&quot;colorizer&quot;).detach_from_buffer(0)
          require(&quot;colorizer&quot;).detach_from_buffer()

      Detach from buffer with id 22:
          require(&quot;colorizer&quot;).detach_from_buffer(22)
</pre>
    </ul>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#highlight_buffer">highlight_buffer ()</a></td>
	<td class="summary">Highlight the buffer region.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#rehighlight">rehighlight (bufnr, ud_opts, buf_local_opts, hl_opts)</a></td>
	<td class="summary">Rehighlight the buffer if colorizer is active</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#get_attached_bufnr">get_attached_bufnr (bufnr)</a></td>
	<td class="summary">Get attached bufnr</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#is_buffer_attached">is_buffer_attached (bufnr)</a></td>
	<td class="summary">Check if buffer is attached to colorizer</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#reload_all_buffers">reload_all_buffers ()</a></td>
	<td class="summary">Reload all of the currently active highlighted buffers.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#reload_on_save">reload_on_save (pattern)</a></td>
	<td class="summary">Reload file on save; used for dev, to edit expect.txt and apply highlights from returned setup table</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#attach_to_buffer">attach_to_buffer (bufnr, ud_opts, bo_type)</a></td>
	<td class="summary">Attach to a buffer and continuously highlight changes.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#detach_from_buffer">detach_from_buffer (bufnr)</a></td>
	<td class="summary">Stop highlighting the current buffer.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#setup">setup (opts)</a></td>
	<td class="summary">Easy to use function if you want the full setup without fine grained control.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#clear_highlight_cache">clear_highlight_cache ()</a></td>
	<td class="summary">Clears the highlight cache and reloads all buffers.</td>
	</tr>
</table>

<br/>
<br/>


    <h2 class="section-header "><a name="Functions"></a>Functions</h2>

    <dl class="function">
    <dt>
    <a name = "highlight_buffer"></a>
    <strong>highlight_buffer ()</strong>
    </dt>
    <dd>
    Highlight the buffer region.





    <h3>See also:</h3>
    <ul>
         <a href="../modules/colorizer.buffer.html#highlight">colorizer.buffer.highlight</a>
    </ul>


</dd>
    <dt>
    <a name = "rehighlight"></a>
    <strong>rehighlight (bufnr, ud_opts, buf_local_opts, hl_opts)</strong>
    </dt>
    <dd>
    Rehighlight the buffer if colorizer is active


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">bufnr</span>
         number: Buffer number (0 for current)
        </li>
        <li><span class="parameter">ud_opts</span>
         table: `user_default_options`
        </li>
        <li><span class="parameter">buf_local_opts</span>
         table|nil: Buffer local options
        </li>
        <li><span class="parameter">hl_opts</span>
         table|nil: Highlighting options
 - use_local_lines: boolean: Use `buf_local_opts` __startline and __endline for lines
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

         table: Detach settings table to use when cleaning up buffer state in `colorizer.detach_from_buffer`
 - ns_id number: Table of namespace ids to clear
 - functions function: Table of detach functions to call
    </ol>




</dd>
    <dt>
    <a name = "get_attached_bufnr"></a>
    <strong>get_attached_bufnr (bufnr)</strong>
    </dt>
    <dd>
    Get attached bufnr


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">bufnr</span>
         number|nil: buffer number (0 for current)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        number: Returns attached bufnr. Returns -1 if buffer is not attached to colorizer.
    </ol>


    <h3>See also:</h3>
    <ul>
         <a href="../modules/colorizer.buffer.html#highlight">colorizer.buffer.highlight</a>
    </ul>


</dd>
    <dt>
    <a name = "is_buffer_attached"></a>
    <strong>is_buffer_attached (bufnr)</strong>
    </dt>
    <dd>
    Check if buffer is attached to colorizer


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">bufnr</span>
         number|nil: buffer number (0 for current)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        boolean: Returns `true` if buffer is attached to colorizer.
    </ol>




</dd>
    <dt>
    <a name = "reload_all_buffers"></a>
    <strong>reload_all_buffers ()</strong>
    </dt>
    <dd>
    Reload all of the currently active highlighted buffers.







</dd>
    <dt>
    <a name = "reload_on_save"></a>
    <strong>reload_on_save (pattern)</strong>
    </dt>
    <dd>
    Reload file on save; used for dev, to edit expect.txt and apply highlights from returned setup table


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">pattern</span>
         string: pattern to match file name
        </li>
    </ul>





</dd>
    <dt>
    <a name = "attach_to_buffer"></a>
    <strong>attach_to_buffer (bufnr, ud_opts, bo_type)</strong>
    </dt>
    <dd>
    Attach to a buffer and continuously highlight changes.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">bufnr</span>
         number|nil: buffer number (0 for current)
        </li>
        <li><span class="parameter">ud_opts</span>
         table|nil: `user_default_options`
        </li>
        <li><span class="parameter">bo_type</span>
         'buftype'|'filetype'|nil: The type of buffer option
        </li>
    </ul>





</dd>
    <dt>
    <a name = "detach_from_buffer"></a>
    <strong>detach_from_buffer (bufnr)</strong>
    </dt>
    <dd>
    Stop highlighting the current buffer.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">bufnr</span>
         number|nil: buffer number (0 for current)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        number: returns -1 if buffer is not attached, otherwise returns bufnr
    </ol>




</dd>
    <dt>
    <a name = "setup"></a>
    <strong>setup (opts)</strong>
    </dt>
    <dd>
    Easy to use function if you want the full setup without fine grained control.
Setup an autocmd which enables colorizing for the filetypes and options specified.
<p>By default highlights all FileTypes.
<p>Example config:~
<pre>
  { filetypes = { "css", "html" }, user_default_options = { names = true } }
</pre>
Setup with all the default options:~
<pre>
    require("colorizer").setup {
      user_commands,
      filetypes = { "*" },
      user_default_options,
      -- all the sub-options of filetypes apply to buftypes
      buftypes = {},
    }
</pre>
Setup colorizer with user options


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">opts</span>
         table|nil: User provided options
        </li>
    </ul>



    <h3>See also:</h3>
    <ul>
         <a href="../modules/colorizer.config.html#">colorizer.config</a>
    </ul>

    <h3>Usage:</h3>
    <ul>
        <pre class="example"><span class="backtick">`require("colorizer").setup()`</span></pre>
    </ul>

</dd>
    <dt>
    <a name = "clear_highlight_cache"></a>
    <strong>clear_highlight_cache ()</strong>
    </dt>
    <dd>
    Clears the highlight cache and reloads all buffers.







</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated - October </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
